import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/status/inherited/trans/share_widget.dart';

class BPageWidget extends StatefulWidget {
  const BPageWidget({super.key});

  @override
  State<BPageWidget> createState() => _BPageWidgetState();
}

class _BPageWidgetState extends State<BPageWidget> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text("${ShareWidget.of(context)?.nickname}"),
        SizedBox(
          height: 20,
        ),
        ElevatedButton(
          onPressed: () {
            ShareWidget.of(context)?.nickname = "我被B改了";
          },
          child: Text("B页面:更改nickname的值"),
        ),
        SizedBox(
          height: 20,
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.of(context).pop();
          },
          child: Text("B页面:使用路由情况返回A"),
        ),
      ],
    );
  }
}
